package day0724API;

import java.io.File;

public class Test13 {
    public static void main(String[] args) {
        File f=new File("src/day0724API/Test13.java");
        String n=f.getName();
        System.out.println(n);

        long len=f.length();
        System.out.println(len);

        boolean rs1=f.canExecute();
        System.out.println(rs1);
        System.out.println(f.canRead());
        System.out.println(f.canWrite());

        boolean isFile=f.isFile();
        System.out.println(isFile);

        System.out.println(f.isDirectory());

        System.out.println(f.isHidden());

        System.out.println(f.lastModified());


        f.setLastModified(2222);
        f.setExecutable(true);
        f.setReadable(true);
        f.setWritable(true);
        //f.setReadOnly();

        //f.getParent()


        File dir3=new File("src/day0724API/test");
        //调用File类的成员方法getParent: 获取上一级文件夹的路径
        String par=dir3.getParent();
        System.out.println(par);


        File parFile=dir3.getParentFile();
        System.out.println(parFile.getPath());


        File  d=new File("D:\\");
        System.out.println(d.getTotalSpace());
        long canUserSpace=d.getFreeSpace();
        System.out.println(canUserSpace);

        File f3=new File("D:/new 3.java");
        System.out.println(f3.exists());
        f3.setReadOnly();


    }
}
